package com.example.finalwork.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
@Controller
public class LoginController {
    @GetMapping("/login")
    public String loginPage(Model model, String error, String logout) {
        if (error != null) {
            model.addAttribute("errorMsg", "您的用户名或密码不正确。");
        }
        if (logout != null) {
            model.addAttribute("msg", "您已成功登出。");
        }
        return "login";  // 返回 login.html 页面
    }


}
